//
//  MTNewMineHeadView.m
//  met
//
//  Created by 李晓俊 on 2019/6/5.
//  Copyright © 2019 李晓俊. All rights reserved.
//

#import "MTNewMineHeadView.h"

@implementation MTNewMineHeadView

{
    
    CGRect myframe;
    
}
- (MTNewMineHeadView *)initWithFrame:(CGRect)frame

{
    self = [super initWithFrame:frame];
    if (self) {
        NSArray *nibs=[[NSBundle mainBundle]loadNibNamed:@"MTNewMineHeadView" owner:nil options:nil];
        self=[nibs objectAtIndex:0];
        myframe = frame;
        
        self.qianbaoView.userInteractionEnabled = YES;
        UITapGestureRecognizer *qianbao = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(qianbaoClick)];
        [self.qianbaoView addGestureRecognizer:qianbao];
        
        self.dituView.userInteractionEnabled = YES;
        UITapGestureRecognizer *ditu = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dituClick)];
        [self.dituView addGestureRecognizer:ditu];
        
        self.shezhiView.userInteractionEnabled = YES;
        UITapGestureRecognizer *shezhi = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(shezhiClick)];
        [self.shezhiView addGestureRecognizer:shezhi];
        
//        self.nameView.userInteractionEnabled = YES;
//        UITapGestureRecognizer *name = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(nameClick)];
//        [self.nameView addGestureRecognizer:name];
        
        self.nameBg.userInteractionEnabled = YES;
        UITapGestureRecognizer *name = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(nameClick)];
        [self.nameBg addGestureRecognizer:name];
        
        self.angelImage.userInteractionEnabled = YES;
        UITapGestureRecognizer *angle = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(angleClick)];
        [self.angelImage addGestureRecognizer:angle];
    }
    return self;
}
-(void)drawRect:(CGRect)rect

{
    self.frame=myframe;//关键点在这里
}

- (void)qianbaoClick {
    if (self.qianbaoChoose) {
        self.qianbaoChoose(@"1");
    }
}
- (void)dituClick {
    if (self.dituChoose) {
        self.dituChoose(@"1");
    }
}
- (void)shezhiClick {
    if (self.shezhiChoose) {
        self.shezhiChoose(@"1");
    }
}
- (void)nameClick {
    if (self.nameChoose) {
        self.nameChoose(@"1");
    }
}
- (void)angleClick {
    if (self.angleChoose) {
        self.angleChoose(@"1");
    }
}
@end
